#include <boost/python.hpp>
#include <string>

struct World
{
    World() : msg("") { }
    World(std::string msg) : msg(msg) { }
    World(float a, float b) : msg(std::to_string(a - b)) { }
    void set(std::string msg) { this->msg = msg; }
    std::string greet() { return msg; }
    std::string msg;
};


struct Var
{
    Var(std::string name) : name(name), value() { }

    const std::string name;
    float value;
};


struct Num
{
    Num();
    float get() const;
    void set(float value);
    float value;
};

float Num::get() const { return value; }
void Num::set(float value) { this->value = value; }


BOOST_PYTHON_MODULE(hello)
{
    boost::python::class_<World>("World", boost::python::init<std::string>())
        .def(boost::python::init<float, float>())
        .def("greet", &World::greet)
        .def("set", &World::set)
        ;

    boost::python::class_<Var>("Var", boost::python::init<std::string>())
        .def_readonly("name", &Var::name)
        .def_readwrite("value", &Var::value)
        ;

    boost::python::class_<Num>("Num")
        .add_property("rovalue", &Num::get)
        .add_property("value", &Num::get, &Num::set);
}
